<?php
namespace app\index\controller;
use OSS\OssClient;


class Oss
{
    public function index()
    {
        $oss = new OssClient('LTAIyPh6nLkVytpZ','9A82uU2Zd6Cy5lIoXaUck6fuKsCxUS','http://oss-cn-shenzhen.aliyuncs.com');
        $listObjectInfo = $oss->listObjects('huanleshengxiao',['prefix'=>'user_img/','max-keys'=>'100']);
//        dump($listObjectInfo);
        $listObject = $listObjectInfo->getObjectList();
        $listPrefix = $listObjectInfo->getPrefixList();

        if (!empty($listObject)) {
            print("objectList:<br>");
            foreach ($listObject as $objectInfo) {
                print($objectInfo->getKey() . "<br>");
            }
        }
        if (!empty($listPrefix)) {
            print("prefixList: <br>");
            foreach ($listPrefix as $prefixInfo) {
                print($prefixInfo->getPrefix() . "<br>");
            }
        }

    }


}
